package edu.snake.implement.command;

import edu.snake.core.controller.command.Algorithm;

import java.util.ArrayList;
import java.util.List;


public class ListAlgorithm implements Algorithm {
    private List<Algorithm> algorithms;

    public ListAlgorithm() {
        algorithms = new ArrayList<Algorithm>();
    }

    @Override
    public void action() {
        for (Algorithm algorithm : algorithms) {
            algorithm.action();
        }
    }

    public void add(Algorithm algorithm) {
        //todo        check if not null
        algorithms.add(algorithm);
    }

    public void remove(Algorithm algorithm) {
        //todo        check if not null
        algorithms.remove(algorithm);
    }
}
